package cn.school.demo.ui.answer

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.work.Data
import cn.school.demo.MyApplication
import cn.school.demo.pojo.Rank
import cn.school.demo.repository.DataRepository

class RankingViewModel : ViewModel() {

    private val _rankList = mutableListOf<Rank>()
    val rankList: MutableList<Rank> get() = _rankList

    fun updateRankList(list: MutableList<Rank>) {
        _rankList.clear()
        _rankList.addAll(list)
    }

    fun getRanking(): LiveData<MutableList<Rank>> =
        DataRepository().getScoreRanking(MyApplication.subjectList[0].signid)
}